package com.ias.agdis_r.util.network;

import com.ias.agdis_r.util.S;

import java.util.HashMap;
import java.util.Map;

/**
 * 网络相关助手类
 * 
 * @author wuguiyu,wanghu
 * 
 */
public class NetUtils {

	// wifi安全类型
	// 通过WifiConfiguration类中allowedKeyManagement.get(KeyMgmt.属性)属性判断
	public static String WifiConfiguration_OPEN = "OPEN";// 开放类型无密码
	public static String WifiConfiguration_EAP_SIM_AKA = "EAP-SIM/AKA";// EAP-SIM/AKA类型
	public static String WifiConfiguration_WEP = "WEP";// WEP类型
	public static String WifiConfiguration_WPA_WPA2_PSK = "WPA/WPA2 PSK";// WPA/WPA2
	// PSK类型
	public static String WifiConfiguration_8021x_EAP = "802.1x EAP";// 802.1x
	// EAP类型
	public static String WifiConfiguration_WAPI_PSK = "WAPI PSK";// WAPI PSK类型
	public static String WifiConfiguration_WAPI_CERT = "WAPI CERT";// WAPI
	// CERT类型
	// 通过ScanResult类中capabilities属性判断
	public static String ScanResult_WEP = "";// WEP类型
	public static String ScanResult_WPA = "WPA";// WPA类型只要包含此字符串的类型全认为是wpa

	public static String SENDNETSTATUS = "sendNetStatus";// 发送网络状态
	public static String SENDGPSSTATUS = "sendGpsStatus";// 发送Gps状态

	public static int PRIVATENETTYPE = 1;// 专网类型
	public static int PUBLICNETTYPE = 2;// 公网GPRS类型
	public static int WIFINETTYPE = 3;// wifi网类型

	public static String NET_STATU_MESSAGE = "net_statu_message";// 广播时 字符串名
	public static String SERVER_MESSAGE = "server_message";// 广播时 字符串名

	// gps
	public static String GPS_SUCCESS = "GPS_SUCCESS"; // GPS可获取到信号
	public static String GPS_NOSIGN = "GPS_NOSIGN"; // GPS没信号
	public static String GPS_SEND = "GPS_SEND"; // GPS发送数据

	// 网络处理步骤返回的网络状态结果 无信号,没ping通, ping通,socket连接成功,正在使用
	/*-------------------------------------网络状态-----------------------------------------------*/
	public static String GETADDRESS_SUCCESS = "GETADDRESS_SUCCESS";// 获取本机地址成功
	public static String GETADDRESS_FAILED = "GETADDRESS_FAILED";// 获取本机地址失败
	public static String CONN_SUCCESS = "CONN_SUCCESS";// PING Server成功

	private static Map<String, Integer> status_image = new HashMap<String, Integer>();

	static {
		// // 每个网络有三个状态 edit by zhangsc
		// // ==============专网================
		// // 1.网络断开连接
		// status_image
		// .put(S.contact(PrivateNetService.class.getName(),
		// GETADDRESS_FAILED), R.drawable.net_priv_nosign);
		// // 2.网络连接
		// status_image.put(S.contact(PrivateNetService.class.getName(),
		// GETADDRESS_SUCCESS), R.drawable.net_priv_ping);
		// // 3.连接到网关
		// status_image.put(
		// S.contact(PrivateNetService.class.getName(), CONN_SUCCESS),
		// R.drawable.net_priv_using);
		//
		// // ==============WIFI================
		// // 1.网络断开连接
		// status_image.put(
		// S.contact(WifiNetService.class.getName(), GETADDRESS_FAILED),
		// R.drawable.net_wifi_nosign);
		// // 2.网络连接
		// status_image.put(
		// S.contact(WifiNetService.class.getName(), GETADDRESS_SUCCESS),
		// R.drawable.net_wifi_ping);
		// // 3.连接到网关
		// status_image.put(
		// S.contact(WifiNetService.class.getName(), CONN_SUCCESS),
		// R.drawable.net_wifi_using);
		//
		// // ==============公网================
		// // 1.网络断开连接
		// status_image.put(
		// S.contact(PublicNetService.class.getName(), GETADDRESS_FAILED),
		// R.drawable.net_publ_nosign);
		// // 2.网络连接
		// status_image
		// .put(S.contact(PublicNetService.class.getName(),
		// GETADDRESS_SUCCESS), R.drawable.net_publ_ping);
		// // 3.连接到网关
		// status_image.put(
		// S.contact(PublicNetService.class.getName(), CONN_SUCCESS),
		// R.drawable.net_publ_using);
		//
		// // ==============GPS================
		// // GPS图标
		// status_image.put(GPS_NOSIGN, R.drawable.gps_nosign);
		// status_image.put(GPS_SUCCESS, R.drawable.gps_work);
		// status_image.put(GPS_SEND, R.drawable.gps_send);
	}

	public static int getDrawable(Object obj, String content) {
		// 网络图标根据类名进行区分，GPS图标不区分
		if (obj == null) {
			return status_image.get(content);
		} else {
			return status_image.get(S
					.contact(obj.getClass().getName(), content));
		}
	}

	/** 是否关闭语音功能 **/
	public static String PHONE_STATUS = "1";
	public static boolean MODIFY_NAME_FLAG = false;
	public static boolean GROUP_SELECT_DISPATCH = false; // 是否选中调度台
	public static boolean netChangeFlag = false;
}
